var ngAppDemo =  angular.module('ngAppDemo', ['ngRoute' ,'templateControllers' , 'templateServices']);

ngAppDemo.config(['$routeProvider',
  function($routeProvider) {
    $routeProvider.
      when('/index', {
        templateUrl: 'index.html',
        controller: 'templateList'
    }).
      otherwise({
        redirectTo: '/index'
      });

}]);


function settingController($scope){
  $scope.greet = function(){

  	alert("Hello");
  }
}


function CartController($scope){
	$scope.items = [
        {title : 'catalog1'  , descripcion : 8 , fechaExamen: 3.95 } , 
        {title : 'catalog2'  , descripcion : 8 , fechaExamen: 3.95 } , 
        {title : 'catalog3'  , descripcion : 8 , fechaExamen: 3.95 } 
	];

  $scope.add = function(){
  	    //alert($scope.textName) ;
        $scope.items.push({title: $scope.textTitle, quantity: $scope.textQuantity, price: $scope.textPrice});

  }

  $scope.remove = function(index) {
		$scope.items.splice(index, 1);
  }
  $scope.showTotal = function(){
        var count = 0;
        angular.forEach($scope.items, function(item) {
        count += item.price * item.quantity;
        });
        return count;
 }
}


function TemplateController($scope , $http){

var url = 'http://lprqaesb01:9108/dmendpoint/admin/get/templates';

$http.get(url , {} ).success(function( data , status , headers , config ){
$scope.templates = data.body.data;  
} ).error(function(){

});
//$scope.templates = $scope.json.body.data;
}

